Skip to content

fix(test): make StackNavHostTest survive routes that use hiltViewModel#30

Merged
netqo merged 2 commits into
devfrom
fix/instrumented-tests-hilt-host
May 27, 2026
Merged

fix(test): make StackNavHostTest survive routes that use hiltViewModel#30
netqo merged 2 commits into
devfrom
fix/instrumented-tests-hilt-host

Conversation

@netqo
Copy link
Copy Markdown
Owner

@netqo netqo commented May 27, 2026

Summary

  • The instrumented nav smoke suite has been failing on every_static_route_is_reachable and parametric_routes_resolve_with_arguments since the placeholders for Login / News / Assistant became real screens calling hiltViewModel(). The default createComposeRule() mounts a plain ComponentActivity that Hilt cannot wire, surfacing "Given component holder class androidx.activity.ComponentActivity does not implement interface dagger.hilt.internal.GeneratedComponent...".
  • Adds a bare @AndroidEntryPoint HiltTestActivity in src/debug/ (variant-scoped: the release APK never ships it) so the debug build's PackageManager can resolve the activity the test launches. Keeping the class in src/androidTest/ would have produced "Unable to resolve activity" because instrumentation runs against the target APK, not the test APK.
  • Rewires StackNavHostTest to use HiltAndroidRule + createAndroidComposeRule<HiltTestActivity>() via a RuleChain so Hilt injects before the activity launches. The static-route check now navigates via route.defaultPath so Wallet's parametric ?tab={tab} route still resolves cleanly.

Test plan

  • ./gradlew assembleDebug
  • ./gradlew ktlintCheck
  • ./gradlew detekt
  • ./gradlew connectedDebugAndroidTest -> 26/26 instrumented tests passing on device (previously 24/26).

netqo added 2 commits May 27, 2026 19:13
The Android Studio template robot was still shipping as the app icon
and as the splash mark. Ports the layered-squares glyph the login
hero uses (LoginScreen.StackLogoGlyph) into the launcher + splash
slots so the app's branding is consistent from the launcher tap
through to the first Compose frame.

  * ic_launcher_foreground: brand glyph sized for the adaptive-icon
    safe zone (central 66dp of a 108dp viewport) so the corners
    survive round / squircle launcher masks.
  * ic_launcher_background: solid SurfaceBase (#0B0B12) plate that
    matches the window background, so the splash-to-content
    transition doesn't flash a different color.
  * ic_launcher_monochrome: single-tint variant for Android 13+
    themed icons (the previous adaptive-icon XML pointed monochrome
    at the colored foreground, which the platform can't recolor
    cleanly).
  * ic_brand_splash: standalone splash glyph that fills the full
    108dp viewport. The launcher foreground has to keep its content
    inside the safe zone and would render visibly small in the
    SplashScreen API icon area (no mask is applied there); this
    drawable expands the same three squares so the splash reads as
    the Stack mark instead of a tiny inset.
  * themes.xml: splash theme now points at ic_brand_splash.

Legacy mipmap-{m,h,xh,xxh,xxxh}dpi PNGs are untouched. They only
ship to API 24-25 devices that can't load the adaptive-icon XML
(min SDK is 24, so the fallback is required); generating new PNGs
from the vector needs a build-time tool that isn't wired in yet.
The smoke suite started failing the moment real screens replaced the
nav placeholders, because the default createComposeRule() launches a
plain ComponentActivity that Hilt cannot wire ("Given component
holder class androidx.activity.ComponentActivity does not implement
interface dagger.hilt.internal.GeneratedComponent...").

Adds a bare `@AndroidEntryPoint HiltTestActivity` in `src/debug/` so
the debug APK ships it (the instrumentation runner resolves
activities through the target APK's PackageManager, so the class
cannot live in `src/androidTest/` alone). The test now wires
HiltAndroidRule + createAndroidComposeRule<HiltTestActivity>() via a
RuleChain so Hilt injects before the activity launches; navigation
uses defaultPath to support Wallet's optional `?tab={tab}` query
arg without re-asserting the bare path.

All 26 instrumented tests pass on device after this change.
@netqo netqo merged commit 81c9ac6 into dev May 27, 2026
2 checks passed
@netqo netqo deleted the fix/instrumented-tests-hilt-host branch May 27, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant